// 测试Gitee仓库连接
const { exec } = require('child_process');
const { promisify } = require('util');

const execAsync = promisify(exec);

async function testGiteeConnection() {
  console.log('=== Gitee仓库连接测试 ===\n');
  
  try {
    // 测试远程仓库连接
    console.log('1. 测试远程仓库连接...');
    const { stdout: remote } = await execAsync('git remote -v');
    console.log('远程仓库配置:');
    console.log(remote);
    
    // 测试仓库状态
    console.log('2. 测试仓库状态...');
    const { stdout: status } = await execAsync('git status');
    console.log('Git状态:');
    console.log(status);
    
    // 测试推送历史
    console.log('3. 测试推送历史...');
    const { stdout: log } = await execAsync('git log --oneline -n 3');
    console.log('最近3次提交:');
    console.log(log);
    
    // 测试分支信息
    console.log('4. 测试分支信息...');
    const { stdout: branch } = await execAsync('git branch -a');
    console.log('分支信息:');
    console.log(branch);
    
    console.log('\n✅ Gitee仓库连接测试完成！');
    console.log('仓库地址: https://gitee.com/jyc201/tank-game');
    console.log('代码已成功上传到Gitee仓库。');
    
  } catch (error) {
    console.error('❌ 测试失败:', error.message);
  }
}

testGiteeConnection();
